import request from '@/utils/request'
import { RolePageQuery, RolePageRes } from '@/model/system/RolePage'
import { RoleAdd } from '@/model/system/RoleAdd'

/**
 * 角色分页
 * @param data
 * @returns
 */
export function rolePage(data: RolePageQuery): Promise<RolePageRes> {
  return request.get<RolePageRes>('/api/auth/role/page', data)
}

/**
 * 新增角色
 * @param data
 * @returns
 */
export function addRole(data: RoleAdd): Promise<undefined> {
  return request.post<undefined>('/api/auth/role', data)
}

/**
 * 删除角色
 * @param data
 * @returns
 */
export function deleteRole(id: number): Promise<undefined> {
  return request.delete<undefined>('/api/auth/role/' + id)
}

/**
 * 删除角色
 * @param data
 * @returns
 */
export function updateRole(data: RoleAdd): Promise<undefined> {
  return request.put<undefined>('/api/auth/role/' + data.id, data)
}
